<#macro cheer entryId cheerCount component youCheerThis=true> 
	<#if component == "GOAL_ENTRY">
		<#assign isEntryDone = 'false'>
		<#assign isCheer = 'false'>
		<#assign text1 = ' động viên'>
		<#assign text2 = 'Động viên'>
	<#else>
		<#assign isEntryDone = 'true'>
		<#assign isCheer = 'true'>
		<#assign text1 = ' chúc mừng'>
		<#assign text2 = 'Chúc mừng'>
	</#if>
	
	<#if data.userInSession??>
		<#if youCheerThis>
    		<a class="cheerCount" rel="${entryId}" href="${rc.contextPath}/ajax/userList.html?type=CHEER_ENTRY&entryId=${entryId}&pageId=1&isEntryDone=${isEntryDone}&total=${cheerCount}"><b>${cheerCount}</b>${text1}</a>
    		<script type="text/javascript">
    			jQuery("a.cheerCount").fancybox();
    		</script>
    	<#else>
    		<a id="cheer_entry_button_${entryId}" class="cheerCount" rel="${entryId}">${text2}</a>
    		<script type="text/javascript">
    			jQuery("#cheer_entry_button_${entryId}").click(function() {
    				UserManagerExt.cheerThisEntry(${entryId}, function(result) {
    					if (result == 1) {
    						cheerCount = parseInt(${cheerCount}) + 1;
    						jQuery("#cheer_entry_button_${entryId}").html("<b>" + cheerCount + "</b>${text1}");
    						jQuery("#cheer_entry_button_${entryId}").attr("href", "${rc.contextPath}/ajax/userList.html?type=CHEER_ENTRY&entryId=${entryId}&pageId=1&isEntryDone=${isEntryDone}&total=" + cheerCount);
    						jQuery("#cheer_entry_button_${entryId}").unbind("click");
    						jQuery("#cheer_entry_button_${entryId}").fancybox();
    					} else {
    						iAlert("Yêu cầu của bạn không thành công");
    					}
    				});
    			});
    		</script>
		</#if>
	<#elseif cheerCount gt 0>
    	<a class="cheerCount" rel="${entryId}" href="${rc.contextPath}/ajax/userList.html?type=CHEER_ENTRY&entryId=${entryId}&pageId=1&isEntryDone=${isEntryDone}&total=${cheerCount}"><b>${cheerCount}</b>${text1}</a>
    	<script type="text/javascript">
			jQuery("a.cheerCount").fancybox();
		</script>
	</#if> 
</#macro>